<template>
  <j-modal
    :title="`技师审核`"
    :width="400"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-form-model :label-col="labelCol" :wrapper-col="wrapperCol">
      <a-form-item label="技师审核">
        <a-select v-model="model.checkStatus" placeholder="请选择">
          <a-select-option value="1"> 审核通过 </a-select-option>
          <a-select-option value="2"> 审核不通过 </a-select-option>
        </a-select>
      </a-form-item>
    </a-form-model>
  </j-modal>
</template>

<script>
import moment from 'moment'
import { httpAction, getAction } from '@/api/manage'
export default {
  name: 'XhdjOrderInfoModal',
  data() {
    return {
      title: '操作',
      visible: false,
      model: { refundAmount: 0 },
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },

      confirmLoading: false,
      validatorRules: {},
      url: {
        add: '/xhdjCoachInfo/audit',
        edit: '/xhdjOrderInfo/xhdjOrderInfo/edit',
        examine: '/xhdjCoachInfo/audit',
      },
      outAmount: 0,
    }
  },
  created() {},
  methods: {
    add() {
      //初始化默认值
      this.edit({})
    },
    edit(record) {
      this.model.id = record.id
      this.visible = true
    },
    close() {
      this.$emit('close')
      this.model = {
        id: null,
        refundAmount: null,
      }
      this.outAmount = null
      this.visible = false
    },
    handleOk() {
      const that = this
      // 触发表单验证
      that.confirmLoading = true
      let httpurl = ''
      let method = ''
      httpurl += that.url.examine
      method = 'post'
      if (!that.model.checkStatus) {
        that.confirmLoading = false
        return this.$message.error('请审核')
      }
      httpAction(httpurl, this.model, method).then((res) => {
        if (res.success) {
          that.$message.success(res.message)
          that.$emit('ok')
          this.close()
        } else {
          that.$message.warning(res.message)
        }
      })
    },
    handleCancel() {
      this.close()
    },
  },
}
</script>

<style lang="less" scoped></style>
